package com.spzx.product.controller;


import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商品分类 前端控制器
 * </p>
 *
 * @author spzx
 * @since 2024-12-19
 */
@Tag(name = "商品分类")
@RestController
@RequestMapping("/category")
public class CategoryController extends BaseController {

    @Autowired
    private CategoryService categoryService;

    @Operation(summary = "获取分类下拉树列表")
//    @RequiresPermissions("product:category:list")
    @GetMapping("/treeSelect/{id}")
    public AjaxResult treeSelect(
            @Parameter(name = "id", description = "父级ID")
            @Validated
            @PathVariable("id") Long id) {
        return success(categoryService.treeSelect(id));
    }
}
